﻿@using SDK.Authorization

<div class="nav-header-spacer"></div>

@if (_category == Category.Dashboard)
{
    <AuthorizeView Roles="Administrator, Engineer, Reviewer, Auditor">
    <Authorized>
        <MudNavLink Icon="@Icons.Material.Filled.Dashboard" href="dashboard" Match="NavLinkMatch.All"
            Disabled="@(!_isDashboardAvailable)">
            @(_dashboardTitle)
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}

@if (_category == Category.Agents)
{
    <AuthorizeView Roles="Administrator, Engineer, Reviewer">
    <Authorized>
        <MudNavLink Href="agents/overview" Match="NavLinkMatch.All" Class="mb-2">
            <MudText Typo="Typo.subtitle1">
                Overview
            </MudText>
        </MudNavLink>
        <MudText Typo="Typo.subtitle1" Class="ml-3">
            <strong>@_agentName</strong>
        </MudText>
        <MudNavLink Href="@_agentProjectLink" Disabled="@(!_isAgentSelected)">
            Projects
        </MudNavLink>
        <MudNavLink Href="@_agentEditorLink" Disabled="@(!_isAgentSelected)">
            Editor
        </MudNavLink>
        <MudNavLink Href="@_agentDevicesLink" Disabled="@(!_isAgentSelected)">
            Devices
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}

@if (_category == Category.Cognitive)
{
    <AuthorizeView Roles="Administrator, Engineer, Reviewer">
    <Authorized>
        <MudNavLink Href="cognitive/projects">
            <MudText Typo="Typo.subtitle1">
                Projects
            </MudText>
        </MudNavLink>
        <MudNavLink Href="cognitive/jobs">
            <MudText Typo="Typo.subtitle1">
                Jobs
            </MudText>
        </MudNavLink>
        <MudText Typo="Typo.subtitle1" Class="ml-3 mt-2">
            <strong>@_cognitiveProjectName</strong>
        </MudText>
        <MudNavLink Href="@_cognitiveUploadLink" Disabled="@(!_isCognitiveProjectSelected)">
            Upload
        </MudNavLink>
        <MudNavLink Href="@_cognitiveAnnotateLink" Disabled="@(!_isCognitiveProjectSelected)">
            Browse
        </MudNavLink>
        <MudNavLink Href="@_cognitiveDatasetsLink" Disabled="@(!_isCognitiveProjectSelected)">
            Datasets
        </MudNavLink>
        <MudNavLink Href="@_cognitiveModelsLink" Disabled="@(!_isCognitiveProjectSelected)">
            Models
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}

@if (_category == Category.Observability)
{
    <AuthorizeView Roles="Administrator, Engineer, Reviewer, Auditor">
    <Authorized>
        <MudNavLink Href="observability/services" Match="NavLinkMatch.Prefix">
            Services
        </MudNavLink>
        <MudNavLink href="observability/analytics" Match="NavLinkMatch.Prefix" Disabled="@(!_isAnalyticsAvailable)">
            Logs
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}

@if (_category == Category.Audit)
{
    <AuthorizeView Roles="Administrator, Auditor">
    <Authorized>
        <MudNavLink Href="audit/reports/create" Match="NavLinkMatch.All">
            Create Report
        </MudNavLink>
        <MudNavLink Href="audit/reports" Match="NavLinkMatch.All">
            Saved Reports
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}

@if (_category == Category.Admin)
{
    <AuthorizeView Roles="@Roles.Administrator">
    <Authorized>
        <MudNavLink Href="admin/usermanagement" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.ManageAccounts">
            User Management
        </MudNavLink>
    </Authorized>
</AuthorizeView>
}
